home *** CD-ROM | disk | FTP | other *** search
/ AMIGA-CD 2 / Amiga-CD - Volume 2.iso / ungepackte_daten / 1992 / 09 / 2 / window-machine / wm_source.ampk / WM_Prefs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-01  |  2.2 KB  |  115 lines

  1. #include <WM.h>
  2. #include <MyStructs.h>
  3. #include <Prefs.h>
  4.  
  5. VOID SetzPrefs(UBYTE m)
  6. {
  7.     i= (m & 2) ? 5 : 4;
  8.     PText[1].IText=GTexte[i];
  9.     i= (m & 4) ? 3 : 2;
  10.     PText[2].IText=GTexte[i];
  11.     i= (m & 1) ? 7 : 6;
  12.     PText[0].IText=GTexte[i];
  13.     i= (m & 8) ? 2 : 3;
  14.     PText[3].IText=GTexte[i];
  15.     RefreshGList(&PrefGad[6],Wwin,NULL,4);
  16. }
  17. VOID NewPrefs()
  18. {
  19.     Compiler = (PREFSBYTE[0] & 1) ? 1 : 0;
  20.     Kompact = (PREFSBYTE[0] & 2) ? 0 : 1;
  21.     Warning = (PREFSBYTE[0] & 4) ? 1 : 0;
  22.     FarbKopie = (PREFSBYTE[0] & 8) ? 1 : 0;
  23. }
  24. VOID PrintText(ULONG zahl,SHORT ypo,UBYTE col)
  25. {
  26.     sprintf(LEER,"%ld",zahl);
  27.     text(Wrp,2,LEER,182,ypo+1);
  28.     text(Wrp,col,LEER,180,ypo);
  29. }
  30. USHORT Prefs()
  31. {
  32.     USHORT OKB=TRUE;
  33.     ULONG chip_mem,fast_mem;
  34.     ScreenToFront(WMsc);
  35.     PRWindow.Screen=WMsc;
  36.     if(!(Wwin=(struct Window *)OpenWindow(&PRWindow))) return(1);
  37.     WinBorder(Wwin);
  38.     Wrp=Wwin->RPort;
  39.     SetzPrefs(PREFSBYTE[0]);
  40.     PrintIText(Wrp,&PText[14],0,0);
  41.     StrEnd=PREFSBYTE[0];
  42.     chip_mem=AvailMem(MEMF_CHIP);
  43.     fast_mem=AvailMem(MEMF_FAST);
  44.     PrintText(chip_mem,139,1);
  45.     PrintText(fast_mem,149,1);
  46.     PrintText(chip_mem+fast_mem,159,3);
  47.     do
  48.     {
  49.         Wait(1L << Wwin->UserPort->mp_SigBit);
  50.         GetMessage(Wwin);
  51.         switch(class)
  52.         {
  53.             case GADGETUP:
  54.             switch(Id)
  55.             {
  56.                 /* ENDE */
  57.                 case 0: OKB=FALSE;
  58.                     break;
  59.                 /* O K */
  60.                 /* SAVE */
  61.                 case 1:
  62.                 case 2: PREFSBYTE[0]=StrEnd;
  63.                     NewPrefs();
  64.                     OKB=FALSE;
  65.                     if(Id==1)
  66.                     {
  67.                         if(!(Datei=Open("WM_Prefs",MODE_NEWFILE)))
  68.                             Error(1,1,1);
  69.                         else
  70.                         {
  71.                             if(write=Write(Datei,PREFSBYTE,sizeof(PREFSBYTE))
  72.                                 != sizeof(PREFSBYTE))
  73.                                 Error(1,1,1);
  74.                             if(write=Write(Datei,WMColors,sizeof(WMColors))
  75.                                 != sizeof(WMColors))
  76.                                 Error(1,1,1);
  77.                         }
  78.                         if(Datei) Close(Datei);
  79.                     }
  80.                     break;
  81.             } /* switch Id */
  82.             break;
  83.             
  84.             case GADGETDOWN:
  85.             switch(Id)
  86.             {
  87.                 /* Kompact */
  88.                 case 3: StrEnd ^= 2;
  89.                     SetzPrefs(StrEnd);
  90.                     break;
  91.                 /* Warnungen */
  92.                 case 4: StrEnd ^= 4;
  93.                     SetzPrefs(StrEnd);
  94.                     break;
  95.                 /* C-Compiler */
  96.                 case 5: StrEnd ^= 1;
  97.                     SetzPrefs(StrEnd);
  98.                     break;
  99.                 /* Farb-Kopie */
  100.                 case 6: StrEnd ^= 8;
  101.                     SetzPrefs(StrEnd);
  102.                     break;
  103.             } /* switch Id */
  104.             break;
  105.         } /* switch class */            
  106.     } while(OKB); /* do */
  107.     CloseWindow(Wwin);
  108.     Work();
  109.     ScreenToFront(sc);
  110.     Ready();
  111.     return(0);
  112. }
  113.  
  114.  
  115.